home *** CD-ROM | disk | FTP | other *** search
- Path: newshost.lanl.gov!tanmoy
- From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
- Newsgroups: comp.lang.c
- Subject: Re: C uses simple LALR parsing?
- Date: 15 Mar 1996 17:10:54 GMT
- Organization: Los Alamos National Laboratory
- Message-ID: <TANMOY.96Mar15101054@qcd.lanl.gov>
- References: <4i9ilq$92a@sargas.omicron.se>
- NNTP-Posting-Host: qcd.lanl.gov
- Mime-Version: 1.0
- Content-Type: text
- In-reply-to: elias@omicron.se's message of 14 Mar 1996 16:48:58 GMT
-
- In article <4i9ilq$92a@sargas.omicron.se>
- elias@omicron.se (Elias Martenson) writes:
-
- EM: This question has been subject to major debate among me and my firends:
- EM:
- EM: Does the C standard specify what kind of parser to use? If it uses
-
- It is useful in C to distinguish the stages of lexing and parsing.
- A pp-token is the longest sequence at that point which could be a pp-token.
-
- EM: (and is does seem that at least AT&T C and GCC does) a simple
- EM: LALR parser it would mean that the following expression:
- EM:
- EM: a+++++b
- EM:
- EM: Yields:
- EM:
- EM: SYMBOL INCR INCR ADD SYMBOL
- EM:
- EM: Instead of the desired result (which is acieved when doing a++ + ++b):
-
- desired? I certainly don't desire that :-)
-
- EM:
- EM: SYMBOL INCR ADD INCR SYNBOL
- EM:
- EM: Is it legal for a C compiler to parse the expression like the last
- EM: example?
-
- No.
-
- The only place where the lexing of C seems to surprise people is in
- `0x1e+1' kind of stuff being invalid. That is because pp-numbers are
- much larger category of objects than numbers.
-
- Tanmoy
- --
- tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
- Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
- Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
- <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
- internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
- fax: 1 (505) 665 3003 voice: 1 (505) 665 4733 [ Home: 1 (505) 662 5596 ]
-